package com.sinopec.basemodule.adapter

import android.content.Context
import android.graphics.Color
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.sinopec.basemodule.R
import com.sinopec.basemodule.model.PalletCodeStatusModel

/**
 * @author lwj
 * @ClassName: AlreadyReadAreaAdapter
 * @Description: rfid-已读区域数据
 */
class AlreadyReadAreaAdapter (mContext: Context) :
    CommonAdapter<PalletCodeStatusModel>(mContext, R.layout.item_rfid_valid, ArrayList()) {
    override fun convert(
        holder: CustomViewHolder,
        model: PalletCodeStatusModel,
        position: Int
    ) {
        val itemView = holder.itemView
        //异常编码图标
        val iv_error = holder.getView<ImageView>(R.id.iv_error)
        iv_error.visibility = if (!model.state) View.VISIBLE else View.GONE

        //rfid code
        val tv_rfidCode_right = holder.getView<TextView>(R.id.tv_rfidCode_right)
        tv_rfidCode_right.text = model.code
        tv_rfidCode_right.setTextColor(if (!model.state) Color.parseColor("#F97455") else Color.parseColor("#5C5D66"))
    }
}